﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PublicDatumEdit.ascx.cs" Inherits="CentralOffice.WebClient.Archives.PublicDatumEdit" %>

<table class="TableBlock" width="90%" align="center">
<tr>
    <td class="TableData" width=15%>资料名称：</td><td class="TableData" width=35%><asp:TextBox ID="txtName" runat="server" CssClass="BigInput" style="width:60%;"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="必须填写档案标题" ControlToValidate="txtName">*</asp:RequiredFieldValidator><span class="warning">(必填)</span></td>
    <td class="TableData" width=15%>资料类型：</td><td class="TableData" width=35%><asp:DropDownList ID="ddlCategory" runat="server" ></asp:DropDownList></td>
</tr>
<tr>
    <td class="TableData">资料：</td><td class="TableData" colspan="3"><asp:FileUpload ID="fileData" runat="server" Width="96%" /></td>  
</tr>
<tr>
    <td class="TableData">备注：</td><td class="TableData" colspan="3"><asp:TextBox ID="txtRemark" runat="server" CssClass="BigInput"  style="width:96%;"></asp:TextBox></td>
</tr>

<tr align="center" class="TableControl">
    <td colspan="4">
        <asp:Button ID="btnQuery" runat="server" Text="保存"  CssClass="BigButton" OnClick="btnSave_Click" OnClientClick="return clientCheck();" />
        <asp:Button ID="btnContinue" runat="server" Text="保存并继续添加" CssClass="BigButton" style="margin-left:65px;"  OnClick="btnContinue_Click" />
        <input type="reset" value="重置" class="BigButton" style="margin-left:65px;" />
        <input type="button" value="取消" class="BigButton" style="margin-left:65px;" onclick="history.back();" />
    </td>
</tr>
</table>
<asp:Literal ID="lblJavaScript" EnableViewState="false" runat="server"></asp:Literal>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableViewState="false" />

<script type="text/javascript">
//<![CDATA[

    function clientCheck() {
        var txtName = document.getElementById('<%= txtName.ClientID  %>');
        if (txtName.value.length == 0) {
            alert('资料名称不能为空！');
            return false;
        }
        
    }

    jQuery(document).ready(function() {

        jQuery('#<%= fileData.ClientID %>').change(function() {
            var file = document.getElementById('<%= fileData.ClientID  %>');
            var fileName = file.value;
            if (fileName.length > 0) {

                fileName = fileName.substr((fileName.lastIndexOf("\\") > 0 ? fileName.lastIndexOf("\\") + 1 : 0));
                fileName = fileName.substr(0, fileName.lastIndexOf("."));
                var name = document.getElementById('<%= txtName.ClientID  %>');
                if (name.value.length == 0) {
                    name.value = fileName;
                }
            }
        });
    });

//]]>
</script>
